import request from '@/utils/request'

// 获取商品图片列表
export function getProductPictures (query) {
  return request({
    url: '/catalog/product/picture',
    method: 'get',
    params: query
  })
}

// 新增商品图片
export function addPicture (data) {
  return request({
    url: '/catalog/product/picture',
    method: 'post',
    data: data
  })
}
// 更新商品图片(同时更新多个图片)
export function updatePictures (data) {
  return request({
    url: '/catalog/product/picture',
    method: 'put',
    data: data
  })
}


// 查询商品列表
export function listProduct (query) {
  return request({
    url: '/catalog/product/list',
    method: 'get',
    params: query
  })
}

// 查询商品详细
export function getProduct (productId) {
  return request({
    url: '/catalog/product/' + productId,
    method: 'get'
  })
}

// 新增商品
export function addProduct (data) {
  return request({
    url: '/catalog/product',
    method: 'post',
    data: data
  })
}

// 修改商品
export function updateProduct (data) {
  return request({
    url: '/catalog/product',
    method: 'put',
    data: data
  })
}

// 删除商品
export function delProduct (productId) {
  return request({
    url: '/catalog/product/' + productId,
    method: 'delete'
  })
}

// 导出商品
export function exportProduct (query) {
  return request({
    url: '/catalog/product/export',
    method: 'get',
    params: query
  })
}


// 删除商品图片
export function deleteProductPicture (productPictureId) {
  return request({
    url: '/catalog/product/picture/' + productPictureId,
    method: 'delete'
  })
}